﻿CREATE TABLE [dbo].[tblWH_IndexUsage]
(
	[ius_id] INT NOT NULL IDENTITY(1, 1), 
	[ius_server_ssd_id] int NOT NULL,
	[ius_sql_starttime] DATETIME NOT NULL, 
	[ius_databaseid] INT NOT NULL,
	[ius_tableid] INT NOT NULL, 
	[ius_indexid] INT NOT NULL, 
	[ius_type] TINYINT NOT NULL, 
	[ius_is_disabled] BIT NOT NULL DEFAULT (0), 
	[ius_user_updates] INT NOT NULL DEFAULT (0), 
	[ius_user_uses] INT NOT NULL DEFAULT (0), 
	[ius_system_updates] INT NOT NULL DEFAULT (0), 
	[ius_system_uses] INT NOT NULL DEFAULT (0), 
	[ius_is_pkey] BIT NOT NULL DEFAULT (0), 
	[ius_data_space_id] INT NOT NULL,
	CONSTRAINT PK_tblWH_IndexUsage PRIMARY KEY CLUSTERED (ius_id ASC),
	CONSTRAINT [FK_tblWH_IndexUsage_tblMSX_server_discovery] FOREIGN KEY ([ius_server_ssd_id]) REFERENCES [tblMSX_server_discovery] ([ssd_id])
)
GO
CREATE UNIQUE INDEX [IX_tblWH_IndexUsage_Unique_Candidate] ON [dbo].[tblWH_IndexUsage] 
(
	[ius_server_ssd_id],
	[ius_sql_starttime], 
	[ius_databaseid],
	[ius_tableid],
	[ius_indexid]
)
GO